//2.div中放置子元素h1, p
import {init, h} from 'snabbdom'

let patch = init([])

let vnode = h('div#container', [
    h('h1', 'Hello Snabddom'),
    h('p', '这是个p标签')
])

let app = document.querySelector('#app')

let oldVnode = patch(app, vnode)

setTimeout(() => {
    vnode = h('div#container', [
        h('h1', 'Hello World'),
        h('p', 'Hello P')
    ])
    patch(oldVnode, vnode)

    //2s后清空页面内容 
    //patch(oldVnode, null) --官网错误做法
    patch(oldVnode, h('!'))
}, 2000);